<template>
  <van-goods-action>
    <van-goods-action-mini-btn icon="chat" text="客服" />
    <van-goods-action-mini-btn @click="goCart" icon="cart" text="购物车" :info="carttip"/>
    <van-goods-action-mini-btn icon="like-o" text="收藏" />
    <van-goods-action-big-btn  @click="addtoCart" text="加入购物车" />
    <!--<van-goods-action-big-btn text="立即购买" />-->
  </van-goods-action>
</template>

<script>
  import store from '../../vuex/store'
  export default {
    name: "bottom-cart",

    data() {
      return {
        num:0,
        info: {}
      }
    },
    methods: {
      addtoCart(v) {
        this.$emit('addtoCart',v)
      },
      goCart(){
        this.$router.push('/cart')
      }
    },
    computed: {
      carttip() {
        var goodarray = store.state.cart,
          n = 0
        for (var i = 0; i < goodarray.length; i++) {
          n = n + goodarray[i].count
        }
        return n
      }
    }
  }
</script>

<style lang="less" scoped>
  .bottom {
    height: 50px;
    width: 100%;
    border-top: 1px solid @_blk;
    position: fixed;
    bottom: 0;
    left: 0;
    background-color: #fff;
  }


</style>

